import React from 'react'
import { Navigate } from 'react-router-dom'

function withLogin(Com) {
    let token = localStorage.getItem('token')
    return () => {
        if (token) {
            return <Com></Com>
        } else {
            return <Navigate to='/login'/>
        }
    }


}

export default withLogin